package com.sec.etech.ism.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.sec.etech.ism.service.IsmCommonService;
import com.sec.etech.ism.service.IsmMethodService;
import com.sec.etech.ism.service.IsmTaskService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class IsmSendMaterialInfoServiceImpl implements IsmMethodService {
    @Resource
    IsmTaskService ismTaskService;
    @Resource
    IsmCommonService ismCommonService;

    public IsmSendMaterialInfoServiceImpl(){
    }

    @Override
    public JSONObject call(String sysCode, String serviceCode, JSONObject businessParams) throws Exception{
        Integer materialType = businessParams.getInteger("materialType");
        String id = businessParams.getString("id");
        JSONObject componentOrPartsMaterialInfo = ismCommonService.getComponentOrPartsMaterialInfo(materialType, id);
        JSONObject jsonObject=new JSONObject();
        componentOrPartsMaterialInfo.put("materialType",materialType);
        jsonObject.put("data",componentOrPartsMaterialInfo);
        if (componentOrPartsMaterialInfo==null){
            jsonObject.put("flag","false");
        }else jsonObject.put("flag","success");
        return jsonObject;
    }

    @Override
    public String methodName(){
        return "sendMaterialInfo";
    }
}
